#include <stdio.h>
#include <math.h>

int myGCD(int a, int b);
int main(void)
{
	int a,b;
	printf("Please input two number:");
	scanf("%d%d",&a,&b);
	printf("a = %d and b = %d.\n", a, b);
	printf("The GCD of %d and %d is %d.\n", a, b, myGCD(a,b));
        return 0;
}

int myGCD(int a, int b)
{	
	a = fabs(a);
	b = fabs(b);
	if(a < b)
	{
		int change = a;
		a = b;
		b = change;
	}
	int result;
	if(!(a%b))
	{
		result = b;
		printf("1.a = %d and b = %d.\n", a, b);
	}		
	else
	{
		result = myGCD(b,a%b); 
		printf("2.a = %d and b = %d.\n", a, b);
	}
		
	return result;
}
